import { IsString, IsNotEmpty, MaxLength, IsOptional } from "class-validator";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { QueryDto } from "/@/common/dto/query.dto";

export class AddSwiperDto {
  @ApiProperty({ description: "图片地址" })
  readonly url: string;

  @ApiProperty({ description: "商品id" })
  readonly goods_id: number;

  @ApiProperty({ description: "商品类型id" })
  readonly type_id: number;

  @IsOptional()
  @ApiPropertyOptional({ description: "轮播状态" })
  @IsString({ message: "status必须为字符串" })
  @IsNotEmpty({ message: "status不能为空" })
  readonly status: string;

  @IsOptional()
  @ApiPropertyOptional({ description: "备注" })
  @IsString()
  readonly des: string;
}

export class ChangeSwiperDto {
  @ApiProperty({ description: "轮播id" })
  readonly id: number;

  @ApiProperty({ description: "轮播状态" })
  readonly status: string;
}
export class EditSwiperDto extends AddSwiperDto {
  @ApiProperty({ description: "轮播id" })
  readonly id: number;
}
export class GetSwiperDto extends QueryDto {
  @IsOptional()
  @ApiPropertyOptional({ description: "轮播id" })
  readonly id: number;

  @IsOptional()
  @ApiPropertyOptional({ description: "轮播状态" })
  readonly status: string;
}
